import template from './template.html';
import './style.less';
import {componentProxy} from '@/components/proxy';

componentProxy('ui-input',{
    props: {
        type: {
            type: String,
            default: 'text'//text,password,number
        },
        value: {
            type: String||Number,
            default: ""
        },
        size: {
            type: String,
            default: "default"//medium、small 和 mini 三种尺寸
        },
        placeholder: {
            type: String,
            default: ""
        },
        disabled: {
            type: Boolean,
            default: false
        },
        /* bindinput: {
            type: Object,
            default: () => ({})
        } */
    },
    template,
    
	data() {
		return {
            currentValue:this.$props.value
        }
    },
    methods: {
        handleInput(event) {
            this.$emit('input',{value:this.currentValue});

            /* console.log(this.$parent)
            console.log(this.bindinput)
            console.log(typeof this.$parent[this.bindinput.methodName])
            // 如果有配置的事件，则调用父组件的方法
            if (this.bindinput.methodName && typeof this.$parent[this.bindinput.methodName] === 'function') {
                console.log("jjjk")
                this.$parent[this.bindinput.methodName](...this.bindinput.params, event.target.value);
            } */
        }
    }
})